| print(contents[x]) |
| f.close() |
| for x in range(len(contents)): |
| f = open("someTextFile2.txt","r") |
| contents = f.read().split("\n") |
|     print(contents[x]) |
| f.close() |
| for x in range(len(contents)): |
| f = open("someTextFile2.txt","r") |
| contents = f.read().split("\n") |
| 1 | f = open("someTextFile2.txt","r") |
| 2 | contents = f.read().split("\n") |
| 3 | f.close() |
| 4 | for x in range(len(contents)): |
| 5 |     print(contents[x]) |
| 6 |      |
| f = open("someTextFile2.txt","r") |
| print(contents[0]) |
| f.close() |
| contents = f.read().split("\n") |
| 1 | f = open("someTextFile2.txt","r") |
| 2 | contents = f.read().split("\n") |
| 3 | f.close() |
| 4 | print(contents[0]) |
| f.close() |
| contents = f.read().split("\n") |
| f = open("someTextFile2.txt","r") |
| print(contents[1]) |
| 1 | f = open("someTextFile2.txt","r") |
| 2 | contents = f.read().split("\n") |
| 3 | f.close() |
| 4 | print(contents[1]) |
| line = contents[1] |
| f = open("someTextFile2.txt","r") |
| print(line) |
| f.close() |
| line = line.upper() |
| contents = f.read().split("\n") |
| 1 | f = open("someTextFile2.txt","r") |
| 2 | contents = f.read().split("\n") |
| 3 | f.close() |
| 4 | line = contents[1] |
| 5 | line = line.upper() |
| 6 | print(line) |
| f = open("someTextFile1.txt","r") |
| print(contents[x]) |
| f.close() |
| contents = f.read().split("\n") |
| for x in range(len(contents)): |
| f = open("someTextFile1.txt","r") |
|     print(contents[x]) |
| f.close() |
| contents = f.read().split("\n") |
| for x in range(len(contents)): |
| 1 | f = open("someTextFile1.txt","r") |
| 2 | contents = f.read().split("\n") |
| 3 | f.close() |
| 4 | for x in range(len(contents)): |
| 5 |     print(contents[x]) |
| 6 |      |
| num2 = int(num2) |
| print(num1 + num2) |
| f.close() |
| num1 = int(num1) |
| f = open("someTextFile1.txt","r") |
| contents = f.read().split("\n") |
| num1 = contents[0] |
| num2 = contents[1] |
| 1 | f = open("someTextFile1.txt","r") |
| 2 | contents = f.read().split("\n") |
| 3 | f.close() |
| 4 | num1 = contents[0] |
| 5 | num1 = int(num1) |
| 6 | num2 = contents[1] |
| 7 | num2 = int(num2) |
| 8 | print(num1 + num2) |
| f = open("someTextFile2.txt","r") |
| f.close() |
| contents = f.read().split("\n") |
| print(contents[index]) |
| index = random.randint(0,len(contents)-1) |
| import random |
| 1 | import random |
| 2 | f = open("someTextFile2.txt","r") |
| 3 | contents = f.read().split("\n") |
| 4 | f.close() |
| 5 | index = random.randint(0,len(contents)-1) |
| 6 | print(contents[index]) |
| f = open("someTextFile3.txt","r") |
| print(count) |
| for x in range(len(contents)): |
| num = int(num) |
| f.close() |
| num = contents[x] |
| count = 0 |
| count = count + num |
| contents = f.read().split("\n") |
| f = open("someTextFile3.txt","r") |
| print(count) |
| for x in range(len(contents)): |
|     num = int(num) |
| f.close() |
|     num = contents[x] |
| count = 0 |
|     count = count + num |
| contents = f.read().split("\n") |
| 1 | f = open("someTextFile3.txt","r") |
| 2 | contents = f.read().split("\n") |
| 3 | f.close() |
| 4 | count = 0 |
| 5 | for x in range(len(contents)): |
| 6 |     num = contents[x] |
| 7 |     num = int(num) |
| 8 |     count = count + num |
| 9 | print(count) |
| index = random.randint(0,len(contents2)-1) |
| lastName = contents2[index] |
| f = open("someTextFile4.txt","r") |
| index = random.randint(0,len(contents)-1) |
| f.close() |
| contents = f.read().split("\n") |
| import random |
| firstName = contents[index] |
| f = open("someTextFile5.txt","r") |
| print(firstName + " " + lastName) |
| f.close() |
| contents2 = f.read().split("\n") |
| 1 | import random |
| 2 | f = open("someTextFile4.txt","r") |
| 3 | contents = f.read().split("\n") |
| 4 | f.close() |
| 5 | f = open("someTextFile5.txt","r") |
| 6 | contents2 = f.read().split("\n") |
| 7 | f.close() |
| 8 | index = random.randint(0,len(contents)-1) |
| 9 | firstName = contents[index] |
| 10 | |
| 11 | index = random.randint(0,len(contents2)-1) |
| 12 | lastName = contents2[index] |
| 13 | print(firstName + " " + lastName) |
| import random |
| contents = f.read().split("\n") |
| f = open(fileName + ".txt","r") |
| return contents[index] |
| f.close() |
| def getRandom(fileName): |
| lastName = getRandom("someTextFile5") |
| print(firstName + " " + lastName) |
| index = random.randint(0,len(contents)-1) |
| firstName = getRandom("someTextFile4") |
| import random |
|     contents = f.read().split("\n") |
|     f = open(fileName + ".txt","r") |
|     return contents[index] |
|     f.close() |
| def getRandom(fileName): |
| lastName = getRandom("someTextFile5") |
| print(firstName + " " + lastName) |
|     index = random.randint(0,len(contents)-1) |
| firstName = getRandom("someTextFile4") |
| 1 | import random |
| 2 | |
| 3 | def getRandom(fileName): |
| 4 |     f = open(fileName + ".txt","r") |
| 5 |     contents = f.read().split("\n") |
| 6 |     f.close() |
| 7 |     index = random.randint(0,len(contents)-1) |
| 8 |     return contents[index] |
| 9 | |
| 10 | firstName = getRandom("someTextFile4") |
| 11 | lastName = getRandom("someTextFile5") |
| 12 | print(firstName + " " + lastName) |
| for x in range(len(contents)): |
| contents = f.read().split("\n") |
| f = open("someTextFile4.txt","r") |
| if contents[x][0].upper() == "C": |
| f.close() |
| print(contents[x]) |
| for x in range(len(contents)): |
| contents = f.read().split("\n") |
| f = open("someTextFile4.txt","r") |
|     if contents[x][0].upper() == "C": |
| f.close() |
|         print(contents[x]) |
| 1 | f = open("someTextFile4.txt","r") |
| 2 | contents = f.read().split("\n") |
| 3 | f.close() |
| 4 | for x in range(len(contents)): |
| 5 |     if contents[x][0].upper() == "C": |
| 6 |         print(contents[x]) |
| fileName = fileName + str(x) |
| fileName = "someTextFile" |
| if x != 0: |
| contents = f.read().split("\n") |
| for x in range(0,9): |
| f.close() |
| print(fileName + " : " + str(len(contents))) |
| f = open(fileName + ".txt","r") |
|     fileName = fileName + str(x) |
|   fileName = "someTextFile" |
|   if x != 0: |
|   contents = f.read().split("\n") |
| for x in range(0,9): |
|   f.close() |
|   print(fileName + " : " + str(len(contents))) |
|   f = open(fileName + ".txt","r") |
| 1 | for x in range(0,9): |
| 2 |   fileName = "someTextFile" |
| 3 |   if x != 0: |
| 4 |     fileName = fileName + str(x) |
| 5 |   f = open(fileName + ".txt","r") |
| 6 |   contents = f.read().split("\n") |
| 7 |   f.close() |
| 8 |   print(fileName + " : " + str(len(contents))) |
| f.write(contents[x]) |
| f = open("someTextFile.txt","r") |
| f = open("someTextFile.txt","w") |
| f.close() |
| f.close() |
| f.write("\n") |
| contents = f.read().split("\n") |
| for x in range(len(contents)-1): |
|   f.write(contents[x]) |
| f = open("someTextFile.txt","r") |
| f = open("someTextFile.txt","w") |
| f.close() |
| f.close() |
|   f.write("\n") |
| contents = f.read().split("\n") |
| for x in range(len(contents)-1): |
| 1 | f = open("someTextFile.txt","r") |
| 2 | contents = f.read().split("\n") |
| 3 | f.close() |
| 4 | f = open("someTextFile.txt","w") |
| 5 | for x in range(len(contents)-1): |
| 6 |   f.write(contents[x]) |
| 7 |   f.write("\n") |
| 8 | f.close() |
| for y in range(len(countries)): |
| line = line.split(":") |
| for x in range(len(contents)): |
| print("Type in a name") |
| contents = f.read().split("\n") |
| f.close() |
| i = input() |
| line = contents[x] |
| f = open("someTextFile6.txt","r") |
| countries = line[1].strip().split(",") |
| if line[0] == i: |
| print(countries[y]) |
|     for y in range(len(countries)): |
|   line = line.split(":") |
| for x in range(len(contents)): |
| print("Type in a name") |
| contents = f.read().split("\n") |
| f.close() |
| i = input() |
|   line = contents[x] |
| f = open("someTextFile6.txt","r") |
|     countries = line[1].strip().split(",") |
|   if line[0] == i: |
|       print(countries[y]) |
| 1 | f = open("someTextFile6.txt","r") |
| 2 | contents = f.read().split("\n") |
| 3 | f.close() |
| 4 | print("Type in a name") |
| 5 | i = input() |
| 6 | for x in range(len(contents)): |
| 7 |   line = contents[x] |
| 8 |   line = line.split(":") |
| 9 |   if line[0] == i: |
| 10 |     countries = line[1].strip().split(",") |
| 11 |     for y in range(len(countries)): |
| 12 |       print(countries[y]) |
| f = open("someTextFile7.txt","r") |
| for x in range(len(contents)): |
| contents[x] = empty.strip() |
| f.close() |
| break |
| f.close() |
| empty = empty + contents[x][y] |
| if contents[x][y] == "(" or contents[x][y].isdigit(): |
| empty = "" |
| for y in range(len(contents[x])): |
| f = open("studentNames.txt","w") |
| contents = f.read().split("\n") |
| for x in range(len(contents)): |
| f.write(contents[x]) |
| f.write("\n") |
| f = open("someTextFile7.txt","r") |
| for x in range(len(contents)): |
|   contents[x] = empty.strip() |
| f.close() |
|       break |
| f.close() |
|     empty = empty + contents[x][y] |
|     if contents[x][y] == "(" or contents[x][y].isdigit(): |
|   empty = "" |
|   for y in range(len(contents[x])): |
| f = open("studentNames.txt","w") |
| contents = f.read().split("\n") |
| for x in range(len(contents)): |
|   f.write(contents[x]) |
|   f.write("\n") |
| 1 | f = open("someTextFile7.txt","r") |
| 2 | contents = f.read().split("\n") |
| 3 | f.close() |
| 4 | for x in range(len(contents)): |
| 5 |   empty = "" |
| 6 |   for y in range(len(contents[x])): |
| 7 |     if contents[x][y] == "(" or contents[x][y].isdigit(): |
| 8 |       break |
| 9 |     empty = empty + contents[x][y] |
| 10 |   contents[x] = empty.strip() |
| 11 | f = open("studentNames.txt","w") |
| 12 | for x in range(len(contents)): |
| 13 |   f.write(contents[x]) |
| 14 |   f.write("\n") |
| 15 | f.close() |
| f = open("studentNames.txt","w") |
| for x in range(len(contents)): |
| while True: |
| if names[0] != names[0].upper(): |
| f.write(contents[x]) |
| f = open("someTextFile8.txt","r") |
| else: |
| f.write("\n") |
| break |
| names = contents[x].split(" ") |
| contents = f.read().split("\n") |
| names.pop(0) |
| f.close() |
| names.append(names[0].title()) |
| contents[x] = " ".join(names) |
| for x in range(len(contents)): |
| f.close() |
| f = open("studentNames.txt","w") |
| for x in range(len(contents)): |
|   while True: |
|     if names[0] != names[0].upper(): |
|   f.write(contents[x]) |
| f = open("someTextFile8.txt","r") |
|     else: |
|   f.write("\n") |
|       break |
|   names = contents[x].split(" ") |
| contents = f.read().split("\n") |
|       names.pop(0) |
| f.close() |
|       names.append(names[0].title()) |
|   contents[x] = " ".join(names) |
| for x in range(len(contents)): |
| f.close() |
| 1 | f = open("someTextFile8.txt","r") |
| 2 | contents = f.read().split("\n") |
| 3 | f.close() |
| 4 | for x in range(len(contents)): |
| 5 |   names = contents[x].split(" ") |
| 6 |   while True: |
| 7 |     if names[0] != names[0].upper(): |
| 8 |       break |
| 9 |     else: |
| 10 |       names.append(names[0].title()) |
| 11 |       names.pop(0) |
| 12 |   contents[x] = " ".join(names) |
| 13 | f = open("studentNames.txt","w") |
| 14 | for x in range(len(contents)): |
| 15 |   f.write(contents[x]) |
| 16 |   f.write("\n") |
| 17 | f.close() |